package cn.jhc.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jhc.bean.ShopBean;
import cn.jhc.dao.ConnectionFactory;
import cn.jhc.dao.TitleDAO;

@WebServlet(name="the Titles", urlPatterns={"/getTitles.do"})
public class GetAllTitlesServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		TitleDAO dao = new TitleDAO();
		dao.setCon(ConnectionFactory.getConnection());
		List<ShopBean> list = dao.getAllTitles();
		req.setAttribute("titles", list);
		RequestDispatcher dispatcher = req.getRequestDispatcher("/JiTa.jsp");
		dispatcher.forward(req, resp);
		return;
	}
}
